﻿using System;
using Sinacor.Infra.UI.Common;
using Sinacor.Infra.UI.Security.Services;
using Sinacor.UI.Bovespa.Parametro.Communication.Bovespa.Ordens.Ordem;

namespace Sinacor.UI.Bovespa.Parametro.Communication
{
    public class Ordem : BaseCommunication
    {
        #region Construtor
        public Ordem(SessionInformation session)
            : base(session)
        {

        }
        #endregion

        #region Metodo
        //Task : 5435
        //Data :02/03/3009
        //Autor: Andre
        /// <summary>
        /// Retornar a Lista de Mensagem de Justificativa Observacao
        /// </summary>
        /// <returns></returns>
        public ModelCollection<Sinacor.UI.Bovespa.Parametro.Model.Mensagem> ConsultarMensagensJustificativaObservacao()
        {
            IOrdem servico = null;
            ModelCollection<Sinacor.UI.Bovespa.Parametro.Model.Mensagem> response = null;

            try
            {
                using (ServiceInstance<IOrdem> service = new ServiceInstance<IOrdem>())
                {
                    servico = service.TryGetInstance(this.Session);
                    response = (new Communication.Translator.DataContractToModel.Ordem().ToMensagem(servico.ConsultarMensagensJustificativaObservacao()));
                }
            }
            catch (Exception ex)
            {
                base.HandleFault(ex);
            }

            return response;
        }
        #endregion
    }
}
